//
//  NewsImageCell.m
//  Project1
//
//  Created by 黄珂耀 on 15/7/22.
//  Copyright (c) 2015年 黄珂耀. All rights reserved.
//

#import "NewsImageCell.h"
#import "UIImageView+WebCache.h"

@implementation NewsImageCell

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        [self _createSubview];
    }
    return self;
}

- (void)setModal:(NewsImageModal *)modal
{
    _modal = modal;
    [self setNeedsLayout];
}

- (void)_createSubview
{
    newsImageView = [[UIImageView alloc] initWithFrame:self.bounds];
    
    newsImageView.layer.cornerRadius = 10;
    newsImageView.layer.borderWidth = 1;
    newsImageView.layer.borderColor = [UIColor whiteColor].CGColor;
    
    [self addSubview:newsImageView];
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    NSURL *newsImageURL = [NSURL URLWithString:_modal.image];
    [newsImageView sd_setImageWithURL:newsImageURL];
    
}



@end
